function _import(path, arg){
  arg = arg || {};
  var ver = 0;//是否用缓存改这个 0无缓存，大于0有缓存
  if(document.readyState == "complete"){
	  //只能在一开始加载文件的时候使用
    console.log("import method must be immediately run when loading file");
    return;
  }
  var getTypeName = function(fileName){
    var str = fileName.match(/\.([^\.]*)$/);
    return str ? str[1] : "";
  }
  var scripts = document.getElementsByTagName('script');
  scriptEle = scripts[scripts.length-1];
  var scriptSrc = scriptEle.src ? scriptEle.src : location.href;
  scriptSrc = scriptSrc.replace(/(\/)([^\/]*)$/, function(a, b){return b});//去掉文件名
  var rPath = scriptSrc + path;
  //rPath = rPath + "?" + (ver ? ver : Math.random());
  if(rPath.indexOf("?") > -1) {
	    rPath = rPath + "&_cache=" + (ver ? ver : Math.random());
	  }
	  else {
	    rPath = rPath + "?_cache=" + (ver ? ver : Math.random());
	  }
  var typeName = getTypeName(path);
  if(typeName.toLowerCase() == "css"){
    var h = document.getElementsByTagName("head")[0];
    var linkEle = document.createElement("link");
    linkEle.setAttribute("rel", "stylesheet");
    linkEle.setAttribute("type", "text/css");
    linkEle.setAttribute("href", rPath);
    for(var k in arg) {
      linkEle.setAttribute(k, arg[k]); 
    }
    h.appendChild(linkEle);
    //document.write('<link rel="stylesheet" href="' + rPath + '"/>');
  }
  else{
    var attr = ""
    if(arg.defer) {
        attr += " defer"; 
      }    
    document.write('<script charset="utf-8" src="' + rPath + '" ' + attr + '></script>');
  }    
}